<template>
  <div>
    <p>{{ $store.state.user.age }}</p>
    <p>{{ $store.getters['user/abc'] }}</p>
    <p>{{ age }}</p>
    <button @click="$store.commit('updateAge')">更新age</button>
    <br />
    <!-- <button @click="$store.dispatch('updateAgeAfter3s')">3s后更新</button> -->
    <button @click="updateAgeAfter3s">3s后更新</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  computed: {
    ...mapState('user', ['age', 'list'])
  },
  methods: {
    ...mapMutations('user', ['updateAge']),
    ...mapActions('user', ['updateAgeAfter3s'])
  }
}
</script>

<style lang="scss" scoped></style>
